package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.CommodityGroupDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.commoditygroup.vo.*;

/**
 * 组套商品管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CommodityGroupMapper extends BaseMapperX<CommodityGroupDO> {

    default PageResult<CommodityGroupDO> selectPage(CommodityGroupPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CommodityGroupDO>()
                .eqIfPresent(CommodityGroupDO::getGroupCode, reqVO.getGroupCode())
                .likeIfPresent(CommodityGroupDO::getGroupName, reqVO.getGroupName())
                .eqIfPresent(CommodityGroupDO::getCustomerCode, reqVO.getCustomerCode())
                .eqIfPresent(CommodityGroupDO::getSource, reqVO.getSource())
                .eqIfPresent(CommodityGroupDO::getCommodityCount, reqVO.getCommodityCount())
                .eqIfPresent(CommodityGroupDO::getAllQuantity, reqVO.getAllQuantity())
                .eqIfPresent(CommodityGroupDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CommodityGroupDO::getDisabled, reqVO.getDisabled())
                .betweenIfPresent(CommodityGroupDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CommodityGroupDO::getId));
    }

}